package edu.bit.water.dao;

import edu.bit.water.dto.WarningRule;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Mapper
@Repository
public interface WarningRuleDao {
    //查询表中所有记录
    List<WarningRule> queryWarningRule();

    List<WarningRule> queryWarningRuleByCompanyId(@Param("company_id") String company_id);
    //删除
    void deleteWarningRule(@Param("idList") String s);
    //插入值
    int insertWarningRule(WarningRule evaWaterSensorInfo)throws DataIntegrityViolationException;
    //更新
    int updateWarningRule(WarningRule evaWaterSensorInfo)throws DataIntegrityViolationException;
    //查询阈值
    Map<String,Object> queryRuleNameAndRuleName(@Param("sensorRowId") String sensorRowId);
    //查询某传感器规则是否存在
    int querySensorRowIdExist(@Param("sensorRowId") String sensorRowId, @Param("companyId") int companyId);
    List<WarningRule> queryRuleByNameAndCreateDate(@Param("name") String name, @Param("createDate") String createDate);

    Integer getMaxId();

    List<String> querySensorTypeByLocation(@Param("businessId") String businessId, @Param("locations") List<String> locations);
}
